<template>
  <div>
    <el-divider content-position="left">投诉列表</el-divider>
    <div class="tip">
      <h3 >！！注意：</h3>
      <p>当你投诉总数量满<span>50</span>条开始提醒，当满<span>100</span>条则会撤销你的店铺参与资格和上架相关商品等。</p>
      <p>当投诉情况有误则请及时给管理员电话联系，阐明事实，管理员会及时核实处理 。 </p>
    </div>
    <br>
    <!-- 表格 -->
    <template style="table-layout:fixed">
      <el-table
        :data="complaint.results"
        style="width: 100%;">
        <el-table-column
          label="编号"
          type="index"
          align="center">
        </el-table-column>
        <el-table-column :label="`投诉总条数: ${count}`">
          <el-table-column
            prop="contents"
            label="投诉内容"
            align="center"
            
          >
          </el-table-column>
          <el-table-column
            prop="complain_time"
            label="投诉时间"
            align="center"  
            >
          </el-table-column>
          <el-table-column
            label="证据图片"
            >
            <template slot-scope="scope">
              <img :src="scope.row.proofimg " alt="" width="60px">
            </template>
          </el-table-column>
        </el-table-column>
      </el-table>
    </template>   
  </div>
</template>

<script>

import httpApi from "@/http";

  export default {
    data(){
        return{
          // name:'',
          complaint:{},
          count:0,
        }
    },
  methods:{
      // 消息框
      open() {
        this.$alert(`你的店铺已经有50条，当满100条则会取消你的参与资格，请注意整改?`, '注意', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `当前条数: ${this.count}`
            });
          }
        });
      },
     // 封装店铺投诉
      listStoreComplaint(){
        let params = {store_uid:this.$store.state.uid}
        httpApi.complaintApi.listComplaintByid(params).then(res =>{
          // console.log("列表",res);
          this.count = res.data.count
          if(res.data.count >= 50 ){
            this.open()
          }
          // this.open()
          this.complaint = res.data
              
        })
      },
  },
    
    mounted(){
      this.listStoreComplaint()
    }
  }
</script>

<style lang="scss" scoped>
.tip{
  h3{
    margin-bottom: 5px;
    color: red;
  }
  p{
    padding: 3px;
    font-size: 17px;
    span{
      color: red;
      font-size: 20px;
    }
  }
}
  .el-tooltip__popper {
  max-width: 60px;
}


</style>